import { FC } from "react";
import React, { useState } from "react";
import { Button, Modal } from "antd";
type ModelType = {
  title: string;
  content: string;
  children: JSX.Element;
  hand?: () => void;
};
const Model: FC<ModelType> = (props) => {
  const { children } = props;
  const { title, content } = props;
  const [isModalOpen, setIsModalOpen] = useState(false);

  const showModal = () => {
    setIsModalOpen(true);
  };

  const handleOk = () => {
    setIsModalOpen(false);
  };

  const handleCancel = () => {
    setIsModalOpen(false);
  };
  return (
    <>
      <div onClick={showModal}>{children}</div>

      {/* <Button type="primary" onClick={showModal}></Button> */}
      <Modal
        title={title}
        open={isModalOpen}
        onOk={handleOk}
        onCancel={handleCancel}
        okText="确认"
        cancelText="取消"
      >
        <p>{content}</p>
      </Modal>
    </>
  );
};
export default Model;
